﻿@using Apps.Web.Core;
@using Apps.Common;
@using Apps.Models.Sys;
@using Apps.Locale;
@using Apps.Models.Enum;
@using Apps.Models.Flow;
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
    List<Flow_StepModel> stepList = (List<Flow_StepModel>)ViewBag.StepList;
}

<div id="stepAccordion" class="easyui-accordion" data-options="animate:false,fit:true" style="border: 0px;">
    @if (stepList != null)
    {
        for (int i = 0; i < stepList.Count(); i++)
        {
        <div title="第@(i + 1)步：@stepList[i].Name" data-options="tools:[ {
                                iconCls:'fa fa-trash',
                                handler:function(){
                                 DeleteStep('@(stepList[i].Id)');
                                }
                         }]">
            <table class="formtablenormal">
                <tr>
                    <th style="width:120px">步骤名称：</th>
                    <td>@stepList[i].Name</td>
                </tr>
                <tr>
                    <th>步骤说明：</th>
                    <td>@stepList[i].Remark</td>
                </tr>
                <tr>
                    <th>步骤规则：</th>
                    <td>@(EnumMvcHelper.GetEnumDesc<FlowRuleEnum>(stepList[i].FlowRule))</td>
                </tr>
                <tr>
                    <th>步骤审批者：</th>
                    <td>@stepList[i].Execution</td>
                </tr>
                <tr>
                    <th>启用会签：</th>
                    <td>@(stepList[i].IsAllCheck ? "是" : "否")</td>
                </tr>
                <tr>
                    <th>强制完成：</th>
                    <td>@(stepList[i].CompulsoryOver ? "是" : "否")</td>
                </tr>
                <tr>
                    <th>编辑附件：</th>
                    <td>@(stepList[i].IsEditAttr ? "是" : "否")</td>
                </tr>
            </table>

        </div>
        }
    }

</div> 

<script type="text/javascript">
    $(function () {
        $(".fa-trash").click(function () {
            if ($(this).next("a").attr("class") == "accordion-collapse accordion-expand") {
                $(this).next("a").trigger("click");
            }
        });
         
        var title = "@ViewBag.SelStepName";
        if(title != null)
        {
            $("#stepAccordion").accordion("select", title);
        }
        
    });
</script>